home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / bob_espo.swf / scripts / __Packages / MiniGames / JFS / JFSJellyFish.as < prev    next >
Text File  |  2013-04-24  |  2KB  |  73 lines

  1. class MiniGames.JFS.JFSJellyFish extends State
  2. {
  3.    static var sSTATE_IDLE = "Idle";
  4.    static var sSTATE_REMOVING = "Removing";
  5.    static var sSTATE_REMOVED = "Removed";
  6.    static var sSTATE_REACT = "React";
  7.    function JFSJellyFish(_mcRef, _oParent)
  8.    {
  9.       super(_mcRef);
  10.       this.oParent = _oParent;
  11.       this.setState(MiniGames.JFS.JFSJellyFish.sSTATE_IDLE);
  12.       var _loc5_ = Math.round(Math.random() * this.mcRef.mcState._totalframes - 1) + 1;
  13.       this.mcRef.mcState.gotoAndPlay(_loc5_);
  14.       this.mcRef.mcState.mcHeart.gotoAndPlay(_loc5_);
  15.       this.giveEvent();
  16.    }
  17.    function leaveBus()
  18.    {
  19.       this.setState(MiniGames.JFS.JFSJellyFish.sSTATE_REMOVING);
  20.       Controller.getRef().getSounds().playSound("JellyFish_Leave",Controller.nSFX_VOLUME,1);
  21.    }
  22.    function giveEvent()
  23.    {
  24.       this.mcRef.onPress = Delegate.create(this,this.register);
  25.    }
  26.    function removeEvent()
  27.    {
  28.       delete this.mcRef.onPress;
  29.       this.mcRef.onPress = null;
  30.    }
  31.    function react()
  32.    {
  33.       this.setState(MiniGames.JFS.JFSJellyFish.sSTATE_REACT);
  34.    }
  35.    function doPause()
  36.    {
  37.       super.doPause();
  38.       for(var i in this.mcRef.mcState)
  39.       {
  40.          this.mcRef.mcState[i].stop();
  41.       }
  42.    }
  43.    function doUnPause()
  44.    {
  45.       super.doUnPause();
  46.       for(var i in this.mcRef.mcState)
  47.       {
  48.          this.mcRef.mcState[i].play();
  49.       }
  50.    }
  51.    function register()
  52.    {
  53.       this.oParent.takeHook(this);
  54.    }
  55.    function Idle()
  56.    {
  57.    }
  58.    function Removing()
  59.    {
  60.       if(this.stateFinished())
  61.       {
  62.          this.setState(MiniGames.JFS.JFSJellyFish.sSTATE_REMOVED);
  63.          this.oParent.decreaseJellyFishCount();
  64.       }
  65.    }
  66.    function React()
  67.    {
  68.    }
  69.    function Removed()
  70.    {
  71.    }
  72. }
  73.